package com.dnake.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.dnake.panel.HomeActivity;


/**
 * Created by haoyuliu on 2017/3/23.
 */

public class ReplaceBroadcastReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        if (intent.getAction().equals("android.intent.action.PACKAGE_REPLACED")){

            Intent intent2 = new Intent(context, HomeActivity.class);
            intent2.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK| Intent.FLAG_ACTIVITY_CLEAR_TOP);
            context.startActivity(intent2);
        }
    }
}
